#Include g:\AHK\git-ahk-lib\util\event\MouseEvent.ahk
#Include G:\AHK\git-ahk-lib\lib\directOverlay\ShinsOverlayClass.ahk

Esc:: ExitApp()

#Include Button.ahk

bx := (A_ScreenWidth - 92) // 2, by := 500, bw := 92, bh := 32
overlay := ShinsOverlayClass(bx, by, bw, bh, 1, 0, 0)

me := MouseEvent(overlay.gui.Hwnd)
me.Register(MouseEvent.Events.LBUTTON_UP, OnLU)
me.Register(MouseEvent.Events.LBUTTON_DOWN, OnLD)

c := '0x000000', c2 := '0x00AAAA', c3 := '0x255e90'

box0 := Button(Rect(31, 1, 30, 30), c2, c3)
box0.OnEvent(Button.ON_RELEASE, (*) => MsgBox(1))

Refresh()

DrawBase() {
  overlay.FillRectangle(0, 0, bw, bh, '0xffffffff')
  overlay.DrawRectangle(1, 1, bw - 1, bh - 1, '0xff01ffe1')
}

Refresh() {
  overlay.BeginDraw()
  DrawBase()
  box0.Draw(overlay)
  overlay.EndDraw()
}

OnLU(point, *) {
  box0.OnRelease(point.InRect(box0._rect))
  Refresh()
}

OnLD(point, *) {
  if point.InRect(box0._rect)
    box0.OnPressed()
  Refresh()
}